{{include file="common@layout/_meta_x-admin" /}}
<body>
<div class="layui-fluid">
    <div class="layui-row">
        <form class="layui-form">
            {{volist name="categoryGroupList" id="vo"}}
            <div class="layui-form-item">
                <div class="layui-inline" data-id="{{$vo.id}}">
                    <label class="layui-form-label">{{$vo.category_name}}</label>
                    <div class="layui-input-inline">
                        <input data-field="price" value="{{$vo.price}}" class="layui-input price" />
                    </div>
                    <div class="layui-input-inline">
                        <input data-field="vip_price" value="{{$vo.vip_price}}" class="layui-input price" />
                    </div>
                </div>
            </div>
            {{/volist}}
        </form>
    </div>
</div>
</body>
<style>
    .layui-form-label{min-width: 120px;}
    .layui-input-block{margin-left:150px;}
</style>
<script>
    $(function(){
        $('.price').change(function(){
            var _this = $(this)
            var id = _this.parent().parent().data("id");
            $.ajax({
                type:"post",dataType:"json",
                data:{id:id, price:_this.val(), field:_this.data("field")},
                success:function(){
                    layer.msg('更新成功')
                }
            })
        })
    })
    layui.use(['form','jquery'], function(){
        var form = layui.form;
        var $ = layui.jquery;

        //监听提交
        form.on('submit(submitForm)', function(data){
            //console.log(data)
            ajaxRequest('',data.field)
            return false;
        });
    });
</script>
